home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-PPC / ADB.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  69 lines

  1. /*
  2.  * Definitions for ADB (Apple Desktop Bus) support.
  3.  */
  4. #ifndef __PPC_ADB_H
  5. #define __PPC_ADB_H
  6.  
  7. /* ADB commands */
  8. #define ADB_BUSRESET        0
  9. #define ADB_FLUSH(id)        (1 + ((id) << 4))
  10. #define ADB_WRITEREG(id, reg)    (8 + (reg) + ((id) << 4))
  11. #define ADB_READREG(id, reg)    (0xc + (reg) + ((id) << 4))
  12.  
  13. /* ADB default device IDs (upper 4 bits of ADB command byte) */
  14. #define ADB_DONGLE    1    /* "software execution control" devices */
  15. #define ADB_KEYBOARD    2
  16. #define ADB_MOUSE    3
  17. #define ADB_TABLET    4
  18. #define ADB_MODEM    5
  19. #define ADB_MISC    7    /* maybe a monitor */
  20.  
  21. #define ADB_RET_OK    0
  22. #define ADB_RET_TIMEOUT    3
  23.  
  24. #ifdef __KERNEL__
  25.  
  26. struct adb_request {
  27.     unsigned char data[32];
  28.     int nbytes;
  29.     unsigned char reply[32];
  30.     int reply_len;
  31.     unsigned char reply_expected;
  32.     unsigned char sent;
  33.     unsigned char complete;
  34.     void (*done)(struct adb_request *);
  35.     void *arg;
  36.     struct adb_request *next;
  37. };
  38.  
  39. struct adb_ids {
  40.     int nids;
  41.     unsigned char id[16];
  42. };
  43.  
  44. extern enum adb_hw {
  45.     ADB_NONE, ADB_VIACUDA, ADB_VIAPMU, ADB_MACIO
  46. } adb_hardware;
  47.  
  48. extern int (*adb_send_request)(struct adb_request *req, int sync);
  49. extern int (*adb_autopoll)(int devs);
  50. extern int (*adb_reset_bus)(void);
  51.  
  52. /* Values for adb_request flags */
  53. #define ADBREQ_REPLY    1    /* expect reply */
  54. #define ADBREQ_SYNC    2    /* poll until done */
  55.  
  56. void adb_init(void);
  57. int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
  58.         int flags, int nbytes, ...);
  59. int adb_register(int default_id,int handler_id,struct adb_ids *ids,
  60.          void (*handler)(unsigned char *, int, struct pt_regs *, int));
  61. void adb_input(unsigned char *, int, struct pt_regs *, int);
  62.  
  63. int adb_try_handler_change(int address, int new_id);
  64. int adb_get_infos(int address, int *original_address, int *handler_id);
  65.  
  66. #endif /* __KERNEL__ */
  67.  
  68. #endif /* __PPC_ADB_H */
  69.